#include "const.h"

void s_setext(char *buf, size_t n, const char *source, const char *ext) {
	const char *p;

	if ((p = strrchr(source, '.')) != (const char *)0) {
		i_strncpy(buf, n, source, p-source);
		i_strcat(buf, n, ext);
		return;
	}

	*buf = 0;

	i_strcat(buf, n, source);
	i_strcat(buf, n, ext);
}
